package com.baturu.vin.ford.dal.dao;

import com.baturu.vin.ford.dto.FordBtrPartsDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.Set;

/**
 * @Author: chenjiahao
 * @Time: 2019/6/26
 */
public interface FordBtrPartsDAO {
    @Select({"<script>",
            "SELECT basic_parts_name, btr_parts_name, suffix, distinguishing_marks",
            "FROM ford_btr_parts_mapping",
            "WHERE  btr_parts_name in ",
            "<foreach collection='btrPartsNames' item='item' separator=',' open='(' close = ')'>",
            "#{item}",
            "</foreach>",
            "AND is_deleted = 0",
            "</script>"})
    Set<FordBtrPartsDTO> queryBtrPartsNameByBrand(@Param("btrPartsNames") Set<String> btrPartsNames);


    @Select({"<script>SELECT parts_code,btr_parts_name FROM ford_self_parts_code",
            "WHERE btr_parts_name in ",
            "<foreach item='item' index='index' collection='btrPartsNames' open='(' separator=',' close=')'>",
            "#{item}",
            "</foreach>" ,
            "AND is_deleted = 0",
            "</script>",
    })
    Set<FordBtrPartsDTO> queryOilBtrParts(@Param("btrPartsNames") Collection<String> btrPartsNames);
}
